package com.actions;
import javax.servlet.http.*;
import java.util.*;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.beans.*;
import com.DAO.*;
public class ShowBirthdayAction extends org.apache.struts.action.Action{

	private final static String SUCCESS = "success";
    
    
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
    	
    	
    	BirthdayDAO birthdayDao=new BirthdayDAO();
		
    	ArrayList<BirthdayForm> listBirthdays =new ArrayList<BirthdayForm>();
		listBirthdays=birthdayDao.showBirthdays();
		ArrayList<BirthdayForm> listCurrentBirthdays =new ArrayList<BirthdayForm>();
		listCurrentBirthdays=birthdayDao.showCurrentBirthdays();
		
		request.setAttribute("birthdayList",listBirthdays);
		request.setAttribute("currentBirthdayList",listCurrentBirthdays);
		System.out.println(listBirthdays);
    	birthdayDao.closeConnection();
		
		return mapping.findForward(SUCCESS);
		
	} 
}